﻿using System;
using System.ComponentModel;
using Defarm.Annotations;

namespace Defarm.Model.Analisys
{
    public class PositionForAnalisys : INotifyPropertyChanged
    {
        #region Fileds

        private Guid id;

        private string name;

        private int quantity;

        private int recQuantity;

        private int saledCount;

        private double profit;

        private double variationCoef;

        private GroupABC saleGroup;

        private GroupABC profitGroup;

        private GroupXYZ variationGroup;

        private double recCoef;

        #endregion

        public Guid Id
        {
            get { return this.id; }
            set
            {
                this.id = value;
                this.OnPropertyChanged("Id");
            }
        }

        public string Name
        {
            get { return this.name; }
            set
            {
                this.name = value;
                this.OnPropertyChanged("Name");
            }
        }

        public int Quantity
        {
            get
            {
                return this.quantity;
            }
            set
            {
                this.quantity = value;
                this.OnPropertyChanged("Quantity");
            }
        }

        public int RecQuantity
        {
            get
            {
                return this.recQuantity;
            }
            set
            {
                this.recQuantity = value;
                this.OnPropertyChanged("RecQuantity");
            }
        }

        public int SaledCount 
        {
            get
            {
                return this.saledCount;
            } 
            set 
            { 
                this.saledCount = value; 
                this.OnPropertyChanged("SaledCount"); 
            } 
        }

        public double Profit
        {
            get
            {
                return this.profit;
            }
            set
            {
                this.profit = value;
                this.OnPropertyChanged("Profit");
            }
        }

        public double VariationCoef
        {
            get
            {
                return this.variationCoef;
            }
            set
            {
                this.variationCoef = value;
                this.OnPropertyChanged("VariationCoef");
            }
        }

        public GroupABC SaleGroup
        {
            get
            {
                return this.saleGroup;
            }
            set
            {
                this.saleGroup = value;
                this.OnPropertyChanged("SaleGroup");
            }
        }

        public GroupABC ProfitGroup
        {
            get
            {
                return this.profitGroup;
            }
            set
            {
                this.profitGroup = value;
                this.OnPropertyChanged("ProfitGroup");
            }
        }

        public GroupXYZ VariationGroup
        {
            get
            {
                return this.variationGroup;
            }
            set
            {
                this.variationGroup = value;
                this.OnPropertyChanged("VariationGroup");
            }
        }

        public double RecCoef
        {
            get
            {
                return this.recCoef;
            }
            set
            {
                this.recCoef = value;
                this.OnPropertyChanged("RecCoef");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    public enum GroupABC
    {
        NULL,
        A,
        B,
        C,
    }

    public enum GroupXYZ
    {
        NULL,
        X,
        Y,
        Z
    }
}
